package com.wxq.dbtest.elaticsearch.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.ToString;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@Data
@ToString
@Document(indexName = "my_test",type = "_doc",createIndex = false)
public class Student {

    @Id
    @Field(store=true, index = false,type = FieldType.Integer)
    private Integer studentId;

    @Field(store = true,index = true,analyzer = "ik_max_word",searchAnalyzer = "ik_max_word",type = FieldType.Text)
    private String studentName;

    @Field(store = true,index = true,analyzer = "ik_max_word",searchAnalyzer = "ik_max_word",type = FieldType.Date,format = DateFormat.basic_date_time)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    private Date studentBirthday;

    private Double scores;


}
